<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('products', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 20);
            $table->string('cover_img', 80)->default('./products/CoverImgdefault.jpg');
            $table->string('brief', 20);
            $table->text('imgs')->nullable();
            $table->timestamp('time', 6);
            $table->string('characteristic', 80)->nullable();
            $table->string('WorkFrequency', 20)->nullable();
            $table->string('MesngRange', 20)->nullable();
            $table->string('BdArea', 20)->nullable();
            $table->string('MesngAngle', 20)->nullable();
            $table->string('WorkVoltage', 20)->nullable();
            $table->string('RspnsFrequency', 20)->nullable();
            $table->string('PowerDelay', 20)->nullable();
            $table->string('WorkCurrent', 20)->nullable();
            $table->string('InterfaceType', 20)->nullable();
            $table->string('OutputForm', 20)->nullable();
            $table->string('SeparationRate', 20)->nullable();
            $table->string('Accuracy', 20)->nullable();
            $table->string('WorkTempt', 20)->nullable();
            $table->string('StorageTempt', 20)->nullable();
            $table->string('ProtectionLevel', 20)->nullable();
            $table->string('Sensitivity', 20)->nullable();
            $table->string('ResonantFrequency', 20)->nullable();
            $table->string('ShellMaterial', 20)->nullable();
            $table->string('Capacitance', 20)->nullable();
            $table->string('CnnMode', 20)->nullable();
            $table->string('SCategories', 20);
            $table->string('LCategories', 20);
            $table->integer('u_id')->unsigned()->index();
            $table->foreign('u_id')->references('id')->on('users');

            $table->string('EN_name', 20)->unique()->nullable();
            $table->string('EN_brief', 20)->unique()->nullable();
            $table->string('EN_characteristic', 80)->nullable();
            $table->string('EN_SCategories', 20)->nullable();
            $table->string('EN_LCategories', 20)->nullable();
        });
    }
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('products');
    }
}
